/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dmcn.bl.genetics.input;

import java.awt.TextField;
import java.util.Random;

/**
 *
 * @author atsi
 */
public class InputCalculator {

    private static final String ADDRESS_FILE = "input.csv";
    private Input input;

    public InputCalculator() {
    }

    public int[][] calculateCost(int numOfConcetrators, int numOfTerminals) {
        Random rand = new Random();
        int[][] costResult = new int[numOfConcetrators][numOfTerminals];
        for (int i = 0; i < numOfConcetrators; i++) {
            for (int j = 0; j < numOfTerminals; j++) {
                costResult[i][j] = rand.nextInt(141);
            }
        }
        return costResult;
    }

    public int[] calculatefortio(int numOfTerminals) {
        Random rand = new Random();
        int[] fortioResult = new int[numOfTerminals];

        for (int j = 0; j < numOfTerminals; j++) {
            do {
                fortioResult[j] = rand.nextInt(6);
            } while (fortioResult[j] == 0);
        }

        return fortioResult;
    }

    public int[] calculateXwritikotita(int numOfConcetrators) {
        Random rand = new Random();

        int[] sampleValues = {11, 54, 72};
        int[] xwritikotitaResult = new int[numOfConcetrators];
        for (int i = 0; i < numOfConcetrators; i++) {
            int index = rand.nextInt(3);
            xwritikotitaResult[i] = sampleValues[index];
        }
        return xwritikotitaResult;
    }
//    public void init() throws FileNotFoundException, IOException, InvalidConfigurationException {
//        initInput();
//        ExecuteGenetic eg = new ExecuteGenetic();
//        eg.executeGenetic(
//                input,//input object
//                100,//population size
//                100,//num of evolves
//                true,//more options
//                10,//mutation
//                5, //crossover
//                1,
//                1000
//                );
//    }
//
////    private void initForm(){
////        JFrame jFrame = new JFrame("Genetic");
////        Label phgesLabel = new Label("phges");
////        phgesText = new TextField();
////        Label sygkentrotesLabel = new Label("sugkentrotes");
////        sygkentrotesText = new TextField();
////        JPanel panel = new JPanel();
////        panel.add(phgesLabel);
////        panel.add(phgesText);
////        panel
////    }
//
//    private void initInput()  {
//        try {
//            CSVReader reader = new CSVReader(new FileReader(ADDRESS_FILE), ";".charAt(0));
//            String[] nextLine = reader.readNext();
//            Integer phges = Integer.parseInt(nextLine[0]);
//            System.out.println("terminals: " + phges);
//            nextLine = reader.readNext();
//            Integer sygkentrotes = Integer.parseInt(nextLine[0]);
//            System.out.println("concetrators: " + sygkentrotes);
//            Integer[] fortio = new Integer[phges];
//            Integer[] xwritikothta = new Integer[sygkentrotes];
//            Integer[][] kostos = new Integer[sygkentrotes][phges];
//            nextLine = reader.readNext();
//            for (int i = 0; i < phges; i++) {
//                fortio[i] = Integer.parseInt(nextLine[i]);
//            }
//            nextLine = reader.readNext();
//            for (int i = 0; i < sygkentrotes; i++) {
//                xwritikothta[i] = Integer.parseInt(nextLine[i]);
//            }
//            int i = 0;
//            while ((nextLine = reader.readNext()) != null) {
//                for (int j = 0; j < phges; j++) {
//                    kostos[i][j] = Integer.parseInt(nextLine[j]);
//                }
//                i++;
//            }
//            input = new Input(phges, sygkentrotes, fortio, xwritikothta, kostos);
//        } catch (IOException ex) {
//            Logger.getLogger(NewMain.class.getName()).log(Level.SEVERE, null, ex);
//        }
//    }
    /**
     * @param args the command line arguments
     */
//    public static void main(String[] args) throws Exception {
//        NewMain main = new NewMain();
//        main.init();
//    }
}
